package ai.people.netmon.framework.model.response;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @author: Xing.Wei
 * @time: 2020-09-02 10:50
 */
@Data
@ToString
@NoArgsConstructor
public class ResponseResult implements Response {

    /**
     * 成功
     */
    boolean success = SUCCESS;

    /**
     * 状态码
     */
    int code = SUCCESS_CODE;

    /**
     * 提示信息
     */
    String msg;

    public ResponseResult(ResultCode resultCode) {
        this.success = resultCode.success();
        this.code = resultCode.code();
        this.msg = resultCode.message();
    }

    public ResponseResult(ResultCode resultCode, String msg) {
        this.success = resultCode.success();
        this.code = resultCode.code();
        this.msg = msg;
    }

    public static ResponseResult SUCCESS() {
        return new ResponseResult(CommonCode.SUCCESS);
    }

    public static ResponseResult FAIL() {
        return new ResponseResult(CommonCode.FAIL);
    }

}
